package com.test.exam.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.test.exam.service.ExampleService;

@Controller
public class ExampleController {
	@Autowired
	private ExampleService exampleService;
	
	//문제별 보기 목록
	@RequestMapping(value="/admin/example/getExamplesByQuestionIdx/{questionIdx}",
					method=RequestMethod.GET)
	public String getExamplesByQuestionIdx(
			@PathVariable int questionIdx,
			Model model){
		
		model.addAttribute("exampleList", 
				exampleService.getExamplesByQuestionIdx(questionIdx));
		
		return "/admin/example/getExamplesByQuestionIdx";
	}
}
